from django.db import models
from app.salers.models import *
# Create your models here.


# class Department(models.Model):
#     departmentname = models.CharField(max_length=20)

# class Saler(models.Model):
#     salername = models.CharField(max_length=20)
#     mobile = models.IntegerField()
#     qq = models.IntegerField()
#     department = models.ForeignKey(Department, related_name='departmentforeign')
#     islead = models.IntegerField()

class Industry(models.Model):
    industryname = models.CharField(max_length=20)
    createdate = models.DateTimeField()

class Level(models.Model):
    levelname = models.CharField(max_length=20)

class CustomerGroup(models.Model):
    groupname = models.CharField(max_length=20, unique=True)
    ofsaleid = models.ForeignKey(User, related_name="ofsaler")
    createdate = models.DateTimeField(auto_now_add=True)


class Customer(models.Model):
    saler = models.ForeignKey(User, related_name='salerforeign')
    industry = models.ForeignKey(Industry, related_name='industryforeign')
    level = models.ForeignKey(Level, related_name='levelforeign')
    partment = models.CharField(max_length=20,default='')
    customername = models.CharField(max_length=20, unique=True)
    company = models.CharField(max_length=40)
    mobile = models.CharField(max_length=11)
    age = models.IntegerField(default=20)
    birthday = models.DateField(default="1990-01-01")
    qq = models.IntegerField()
    email = models.EmailField(default="")
    wangwang = models.CharField(max_length=10)
    gender = models.IntegerField()
    groupid = models.ForeignKey(CustomerGroup, related_name='cgroup', default=True)
    createdate = models.DateTimeField(auto_now_add=True)
    custype = models.IntegerField(default=1)
    custatus = models.IntegerField(default=1)
    description = models.TextField(default="")